package com.edu.vo;

import java.util.ArrayList;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonInclude;

@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public class SimpleTree {

    private String text;
    private List<SimpleTree> nodes;

    public List<SimpleTree> getNodes() {
        return nodes;
    }

    public void setNodes(List<SimpleTree> nodes) {
        this.nodes = nodes;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public SimpleTree() {
        text = null;
        nodes = new ArrayList<>();
        nodes.clear();
    }

    public SimpleTree(String text) {
        this.text = text;
        nodes = new ArrayList<>();
        nodes.clear();
    }

    /**
     * 添加子树
     *
     * @param tree 子树
     */
    public void addNode(SimpleTree tree) {
        nodes.add(tree);
    }

    /**
     * 置空树
     */
    public void clearTree() {
        text = null;
        nodes.clear();
    }


}
